var app = getApp();

Page({
  data: {
   pinji_detail:{},
   contents: '',
  },
  pinji_detail: function (pin_id) { //拼机详情
    var that = this;
    if (pin_id){
      wx.request({
        url: app.api.kzdsurl + app.interface.pinji_detail,
        method: 'get',
        data: {id: pin_id},
        header: {
          'Content-Type': 'application/x-www-form-urlencoded'
        },
        success: function (res) {
          // debugger
          that.setData({
            pinji_detail: res.data.data,
          });
          //endInitData
        },
        fail: function (e) {
          wx.showToast({
            title: '网络异常！',
            duration: 2000
          });
        },
      });
    }
  
  },
  lookmoredetail: function (e) {
    var that = this;
    var feiji_id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '../feijidetail/index?feiji_id='+feiji_id
    })
  },
  joinAircraft: function () {//加入拼机
    let that = this;

    let userId = wx.getStorageSync('userId');
    if (!userId) {
      app.goLoginPageTimeOut()
      return
    }
   
    console.log(this.dateValue);
    let createdata = {
      seat: 1,
      money: 1,
      username: "测试",
      type: 2,
      phone: 13427936865,
      isfap:0,
      invoice:1,
      address_id:1,
      uid: userId
    };
    wx.request({
      url: app.api.kzdsurl + app.interface.pinji_create,
      method: 'get',
      data: createdata,
      header: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        console.log(res)
    
      },
      fail: function (e) {
        wx.showToast({
          title: '网络异常！',
          duration: 2000
        });
      },
    });

  },
  joinaircrait: function (options) {
    console.log(options);
    var id = options.currentTarget.id;
    wx.navigateTo({
      url: '../joinrelease/index?id=' +id
    })
  },
  onLoad: function (options) {
    // var that = this;
    this.pinji_detail(options.pin_id)
 
  },
  onShareAppMessage: function () {
    return {
      title: '宠物美容学校',
      path: '/pages/index/index',
      success: function(res) {
        // 分享成功
      },
      fail: function(res) {
        // 分享失败
      }
    }
  }



});